package com.cooper.dao.admin;

import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.Insert;
import net.paoding.rose.jade.annotation.ReturnGeneratedKeys;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.Update;

import com.cooper.entity.AddressEntity;

@DAO
public interface AddressDAO {
	
	static final String TABLE_NAME = "d_address";
	
	@ReturnGeneratedKeys
	@Insert(tableName=TABLE_NAME)
	Long saveEntity(AddressEntity entity) throws Exception;

	@Update(tableName=TABLE_NAME, keyColumn="id")
	boolean updateEntity(AddressEntity entity) throws Exception;
	
	@SQL("select * from d_address t where t.deleted='n' and id=:1 ")
	AddressEntity loadById(long addressId) throws Exception;
	
	@SQL("select * from d_address t where t.deleted='n' and origin=:1 and outer_id=:2 ")
	List<AddressEntity> findByOriginAndOuterId(String origin, long outerId) throws Exception;
}
